Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 7x 7x 7x 7x 7x 7x 7x 7x 7x | import { redirectRetired } from "@/lib/collections/retired-redirect";
import { isIdShaped } from "@/lib/id";
import { queryFrom } from "@/lib/searchParam";
type Param = string | string[] | undefined;
interface Props {
params: Promise<{ id: string }>;
searchParams?: Promise<Record<string, Param>>;
}
// The collection home is the items grid now (spec ยง5). Old links keep their view,
// query and undo notice; anything else is dropped. Only allow-listed values are
// copied (removed only when id-shaped), never interpolated raw. The guard runs
// first, inside redirectRetired.
export default async function ItemsListRedirect({ params, searchParams }: Props) {
const { id } = await params;
const sp = (await searchParams) ?? {};
const keep = new URLSearchParams();
if (sp.status === "archived") keep.set("status", "archived");
if (sp.unnamed === "1") keep.set("unnamed", "1");
const q = queryFrom(sp.q);
if (q) keep.set("q", q);
if (isIdShaped(sp.removed)) keep.set("removed", sp.removed);
return redirectRetired(id, "", keep);
}
|